package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Intervention;
import com.itheima.service.InterventionService;
import com.itheima.utils.DateUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RequestMapping("/Intervention")
@RestController
public class InterventionController {

    @Reference
    private InterventionService interventionService;

    @RequestMapping("/findInterventionByOrderDate")
    public Result findInterventionByOrderDate(String orderDate){
        try {
            Date date = DateUtils.parseString2Date(orderDate);
            Intervention intervention= interventionService.findInterventionByOrderDate(date);
            return new Result(true,"查询医生建议成功",intervention);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(true,"查询医生建议失败");
        }
    }
}
